

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
/*importamos las librerías de JasperReports*/
<%@ page import="net.sf.jasperreports.engine.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.swing.JOptionPane" %>

<%
/*Parametros para realizar la conexión*/
Connection conexion;
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
conexion = DriverManager.getConnection("jdbc:sqlserver://192.168.2.2:1433;databaseName=bdipd","sa","");
/*Establecemos la ruta del reporte*/


 File reportFile = new File(application.getRealPath("reportes/estadoActividadesPorObjetivo.jasper"));

    Map parameters = new HashMap();
    parameters.put("idObjEsp",1);
    byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getAbsolutePath(),parameters,conexion);

    response.setContentType("application/pdf");
    response.setContentLength(bytes.length);
    ServletOutputStream ouputStream = response.getOutputStream();
    ouputStream.write(bytes, 0, bytes.length);
    ouputStream.flush();
    ouputStream.close();
%>
